<?php
require_once "globalFunctions.php";
if (isset($_POST["name"]) && isset($_POST["pass"])) {
	if (getDB()->passwdCompare($_POST["name"], $_POST["pass"])) {
		$token = mt_rand();
		$authkey = mt_rand();
		setcookie("TOKEN", $token, time() + (86400 * 30), "/");
		setcookie("AUTHKEY", $authkey, time() + (86400 * 30), "/");
		getDB()->addSession($_POST["name"],$token,$authkey);
	} else {
		echo "passproblem";
	}
} else {
	echo "problem.";
}
?>